So something like
Code:
template<typename T>
vector<T>::iterator sorted_insert(vector<T> &vec, T &val){
    // do stuff
}
Is that what you mean?